import React from 'react'
import {Tabs} from 'antd-mobile'
import { withRouter } from 'react-router-dom'

function Cate(props) {
    let {cate}=props
    return (
        <div>
            <Tabs defaultActiveKey='1'
            onChange={(key) => {
                // console.log(key);
                props.history.push(`/list/${key}`)
            }}
            >
                {cate.length==0?
                <div>暂无数据</div>
                : cate.map(item => {
                    return  <Tabs.Tab 
                    key={item.id}
                    title={item.catename}
                    ></Tabs.Tab>
                })
                }
            </Tabs>
        </div>
    )
}
export default withRouter(Cate)
